package com.ojoin.trade.common.web.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.web.dao.NotificationDao;
import com.ojoin.trade.common.web.domain.Notification;

@Service
public class NotificationService   extends BaseServiceImpl<Notification> {

	@Autowired
	private NotificationDao dao;
    
    public void markReadAll(final Integer userId) {
    	getBaseDao().markReadAll(userId);
    }

    public int fixed(final String type) {
    	return getBaseDao().fixedAll(type);
    }
    
    public void markRead(final int notificationId) {
        Notification data = this.queryById(notificationId);
        if(data == null || data.getRead().equals(Boolean.TRUE)) {
            return;
        }
        data.setRead(Boolean.TRUE);
        this.updateById(data);
    }


	@Override
	protected NotificationDao getBaseDao() {
		return dao;
	}
}
